<template>
  <!-- 编辑弹框 -->
  <el-dialog title="修改" :visible="editDialogVisible" width="45%" @close="editClose">
    <el-form ref="editFormRef" :inline="true" :model="formDate" label-width="100px" class="demo-ruleForm">
      <el-form-item label="姓名" prop="name">
        <el-input v-model="formDate.name" />
      </el-form-item>
      <el-form-item label="日期" prop="date">
        <el-input v-model="formDate.date" />
      </el-form-item>
      <el-form-item label="id" prop="id">
        <el-input v-model="formDate.id" />
      </el-form-item>
      <el-form-item label="密码" prop="passWord">
        <el-input v-model="formDate.passWord" />
      </el-form-item>
      <el-form-item label="手机号" prop="mobile">
        <el-input v-model="formDate.mobile" />
      </el-form-item>
      <el-form-item label="邮箱" prop="email">
        <el-input v-model="formDate.email" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="editClose">取 消</el-button>
      <el-button type="primary" @click="editDialog">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  props: {
    editDialogVisible: {
      type: Boolean,
      default: false
    },
    editForm: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      formDate: {}
    }
  },
  watch: {
    editForm(val) {
      this.formDate = {
        ...(val || {})
      }
    }
  },
  methods: {
    // 监听关闭表单的事件
    editClose() {
      this.$refs.editFormRef.resetFields()
      this.$emit('closeEdit') // 通知父组件关闭弹框
    },
    // 点击修改确定按钮
    editDialog() {
      console.log('点击修改确定按钮')
    }
  }
}
</script>
